package io.renren.common.aliPay;

import com.alipay.api.AlipayClient;
import com.alipay.api.DefaultAlipayClient;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

/**
 * @author Lee
 * @description 支付宝支付配置
 * @date 2020-02-25 18:10
 **/
@Configuration
public class AliConfig {

    @Value("${baseConstant.aliPay.appId}")
    private String appId;

    @Value("${baseConstant.aliPay.gateway}")
    private String gateWay;

    @Value("${baseConstant.aliPay.privateKey}")
    private String privateKey;

    @Value("${baseConstant.aliPay.publicKey}")
    private String publicKey;

    @Value("${baseConstant.aliPay.signType}")
    private String signType;

    public String getAppId() {
        return appId;
    }

    public String getGateWay() {
        return gateWay;
    }

    public String getPrivateKey() {
        return privateKey;
    }

    public String getPublicKey() {
        return publicKey;
    }

    public String getSignType() {
        return signType;
    }

    @Bean
    public AlipayClient alipayClient() {
        return new DefaultAlipayClient(gateWay, appId, privateKey, "json", "UTF-8", publicKey, "RSA2");
    }

}
